var fs = require('fs');
// function to encode file data to base64 encoded string
function base64_encode(file) {
    // 读取二进制数据
    var bitmap = fs.readFileSync(file);
    // convert binary data to base64 encoded string
    return 'data:text/css;base64,'+new Buffer(bitmap).toString('base64');
}

console.log(base64_encode('./wxlogin.css'))